﻿// JScript File

  var datosServidor = new Array( );

 function enviarGrafica(url, parametros)
       { 
  
    
            ajax = objetoAjax();
    		    var flag = true;         
            ajax.open("POST", url, true);
                 
    		    ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		        ajax.setRequestHeader("Content-length", parametros.length);
		        ajax.setRequestHeader("Connection", "close");
    		    
            ajax.onreadystatechange=function() { 
			        if (ajax.readyState == 4 && flag){
                    fntDatosServidor(ajax.responseText); 
                    flag = false;
              }
            }        
            
            ajax.send(parametros);
       }
        
        
        function objetoAjax( ){
	        var http = false;
	        //Use IE's ActiveX items to load the file.
	        if(typeof ActiveXObject != 'undefined') {
		        try {http = new ActiveXObject("Msxml2.XMLHTTP");}
		        catch (e) {
			        try {http = new ActiveXObject("Microsoft.XMLHTTP");}
			        catch (E) {http = false;}
		        }
	        //If ActiveX is not available, use the XMLHttpRequest of Firefox/Mozilla etc. to load the document.
	        } else if (XMLHttpRequest) {
		        try {http = new XMLHttpRequest();}
		        catch (e) {http = false;}
	        }
    	    return http;
        }

       function fntDatosServidor(datos)
       { 
       
         
          datosServidor =  datos.split(";");
      

          var Valor = datosServidor[0];
          var ActReal = datosServidor[1];
          var ActProg = datosServidor[2];
          var Titulo = datosServidor[3];          
          var LabFoot = datosServidor[4];  
 

          
          fnDibujarGrafico( Valor, ActReal, ActProg , Titulo, LabFoot);
    

       
       }
       
       
       function  enviarProducto(url, parametros)
       { 
            
            ajax = objetoAjax();
    		    var flag = true;         
            ajax.open("POST", url, true);
                 
    		    ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		        ajax.setRequestHeader("Content-length", parametros.length);
		        ajax.setRequestHeader("Connection", "close");
    		    
            ajax.onreadystatechange=function() { 
			        if (ajax.readyState == 4 && flag){
                    fntDatos(ajax.responseText); 
                    flag = false;
              }
            }        
            
            ajax.send(parametros);
       }
      
      
      function fntDatos(datos)
       {
       
          datosServidor =  datos.split(";");
          var meta = datosServidor[0];
          var graf = datosServidor[1];
          fnMeta(meta, graf);
 
       }
       